package com.sgb.kjwl.view.ui.activity.manage.special;

import android.text.TextUtils;
import android.view.View;

import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivitySpecialmenbernewDetailBinding;
import com.sgb.kjwl.model.entity.manage.AgentStaffCheckEntity;
import com.sgb.kjwl.viewmodel.manage.SpecialMenBerNewDetailModel;
import com.sgb.kjwl.viewmodel.manage.SpecialMenberDetailBean;

public class SpecialMenberNewDetailActivity  extends AppActivity {
    private  ActivitySpecialmenbernewDetailBinding binding;
    private String id;
    private SpecialMenBerNewDetailModel viewmodel;
    @Override
    protected void initView() {
        id =getIntent().getStringExtra("id");
        binding = DataBindingUtil.setContentView(SpecialMenberNewDetailActivity.this, R.layout.activity_specialmenbernew_detail);
        viewmodel =new ViewModelProvider(this).get(SpecialMenBerNewDetailModel.class);
        binding.include.titleView.setText("详细信息");
        binding.include.ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        viewmodel.auditDetail(this,id);

    }
    public void setview(SpecialMenberDetailBean specialMenberDetailBean){
        if (specialMenberDetailBean.getStatus()==2){
            binding.type.setImageResource(R.mipmap.spe_tongyi);
            binding.remk.setVisibility(View.GONE);
            binding.caozuo.setText("同意加入");
        }else {
            binding.type.setImageResource(R.mipmap.spe_jujue);
            binding.remk.setVisibility(View.VISIBLE);
            binding.caozuo.setText("拒绝");
            binding.remk.setText("拒绝原因 :"+specialMenberDetailBean.getRejectRemark());
        }
        Glide.with(SpecialMenberNewDetailActivity.this).load(specialMenberDetailBean.getImage()).apply(
                new RequestOptions()
                        .placeholder(R.mipmap.def_photo)
                        .fallback(R.mipmap.def_photo)
                        .error(R.mipmap.def_photo)
        ).into(binding.ivUser);
        binding.name.setText(specialMenberDetailBean.getName());
        binding.phone.setText(specialMenberDetailBean.getPhone());
        binding.comname.setText(specialMenberDetailBean.getComName());
        if (!TextUtils.isEmpty(specialMenberDetailBean.getRemark())){
            binding.why.setText(specialMenberDetailBean.getRemark());
        }else {
            binding.why.setText("/");
        }
        binding.mangername.setText(specialMenberDetailBean.getAuditName());

    }
}
